package com.siam.package_rider.service_impl;

import java.util.Date;
import java.util.List;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.siam.package_rider.entity.TbRiderLevel;
import com.siam.package_rider.model.param.TbRiderLevelParam;
import com.siam.package_rider.mapper.TbRiderLevelMapper;
import com.siam.package_rider.service.TbRiderLevelService;

/**
 * ---------------------------
 * 骑手等级表 (TbRiderLevelServiceImpl)         
 * ---------------------------
 * 作者：  高品
 * 时间：  2025-03-29 18:55:18
 * ---------------------------
 */
@Service
public class TbRiderLevelServiceImpl extends ServiceImpl<TbRiderLevelMapper, TbRiderLevel> implements TbRiderLevelService {

	@Autowired
	private TbRiderLevelMapper tbRiderLevelMapper;

	@Override
	public void insert(TbRiderLevelParam param) {
		TbRiderLevel record = new TbRiderLevel();
		BeanUtils.copyProperties(param, record);
		record.setCreateTime(new Date());
        tbRiderLevelMapper.insert(record);
	}

	@Override
	public void delete(Long id) {
		tbRiderLevelMapper.deleteById(id);
	}

	@Override
	public void batchDelete(List<Long> idList) {
		tbRiderLevelMapper.deleteBatchIds(idList);
	}

	@Override
	public void update(TbRiderLevelParam param) {
		TbRiderLevel record = new TbRiderLevel();
		BeanUtils.copyProperties(param, record);
		record.setUpdateTime(new Date());
		tbRiderLevelMapper.updateById(record);
	}

	@Override
	public Page<TbRiderLevel> page(TbRiderLevelParam param) {
        Page<TbRiderLevel> page = tbRiderLevelMapper.page(new Page(param.getPageNo(), param.getPageSize()), param);
        return page;
	}

	@Override
	public TbRiderLevel findById(Long id) {
		return tbRiderLevelMapper.selectById(id);
	}

}
